package com.fx.service.impl;

import cn.hutool.core.date.DateUtil;
import com.fx.entity.ShopTemplate;
import com.fx.mapper.ShopTemplateMapper;
import com.fx.service.ShopTemplateService;
import com.fx.util.IdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service
public class ShopTemplateServiceImpl implements ShopTemplateService {
    @Autowired
    private ShopTemplateMapper shopTemplateMapper;
    @Autowired
    private IdWorker idWorker;

    @Override
    public ShopTemplate getById(String flId) {
        return shopTemplateMapper.getById(flId);
    }

    @Override
    public List<ShopTemplate> getList(Map<String, Object> map) {
        return shopTemplateMapper.queryList(map);
    }

    @Override
    public int getCount(Map<String, Object> map) {
        return shopTemplateMapper.queryCount(map);
    }

    @Override
    public int save(ShopTemplate shopTemplate) {
        shopTemplate.setFlId(String.valueOf(idWorker.nextId()));
        shopTemplate.setFlCreatedTime(DateUtil.now());
        return shopTemplateMapper.save(shopTemplate);
    }

    @Override
    public int updateById(ShopTemplate shopTemplate) {
        return shopTemplateMapper.updateById(shopTemplate);
    }

    @Override
    public int remove(String flId) {
        return shopTemplateMapper.remove(flId);
    }

    @Override
    public int batchRemove(String[] flIds) {
        return shopTemplateMapper.batchRemove(flIds);
    }

}
